@echo off
chcp 65001 >nul
cls
echo.
echo ════════════════════════════════════════════
echo   快速诊断通知问题
echo ════════════════════════════════════════════
echo.

echo [1/4] 编译安装...
call gradlew assembleDebug --quiet && adb install -r app\build\outputs\apk\debug\app-debug.apk >nul 2>&1
echo ✅ 完成

echo.
echo [2/4] 授予权限...
adb shell appops set com.example.munidingwei android:mock_location allow
adb shell pm grant com.example.munidingwei android.permission.ACCESS_FINE_LOCATION 2>nul
adb shell pm grant com.example.munidingwei android.permission.ACCESS_COARSE_LOCATION 2>nul
adb shell pm grant com.example.munidingwei android.permission.POST_NOTIFICATIONS 2>nul
echo ✅ 完成

echo.
echo [3/4] 启动应用...
adb logcat -c
adb shell am start -n com.example.munidingwei/.MainActivity
timeout /t 2 >nul
echo ✅ 完成

echo.
echo [4/4] 开始监控日志...
echo.
echo ════════════════════════════════════════════
echo 📱 请在手机上点击地图设置模拟位置
echo ════════════════════════════════════════════
echo.
echo 观察下面的日志输出：
echo.

adb logcat -s LocationForegroundService:D LocationService:D MainActivity:D MockLocationProvider:D

pause

